home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 2 / BBS in a box - Trilogy II.iso / Files / Hyper / Q-R / ResGenie™ 1.0 / ResGenie™ / ResGenie™.rsrc / TEXT_173_TScalepath.txt < prev    next >
Encoding:
Text File  |  1993-08-02  |  15.3 KB  |  418 lines

  1. --  colorizeHC "add", "HD:Desktop Folder:PICT:Egypt", "161,188,240,248", , "transparent with dithering"
  2. --  ,HD:Desktop Folder:PICT:Egypt,  <-- This (item 2 of line 2) is the full path name of my current picture
  3. --   HD:Desktop Folder:PICT: <-- This is the path to pictures
  4. --  Egypt <-- This (word 2 of line 4) is the name of the PICT file that I will open
  5.  
  6. on mouseUp
  7.   if the short name of me is "Transparent Scaling Path" then
  8.     newfile
  9.     put "Click on the button again to make it scale"
  10.     exit mouseup
  11.   end if
  12.   global Tools
  13.   if the shiftkey is down and the optionkey is down then
  14.     changeAttributes
  15.     exit mouseup
  16.   end if
  17.   if the shiftkey is down and the commandkey is down then
  18.     checkTools
  19.     if Tools is not "Nope" then
  20.       newClipPict
  21.       exit mouseup
  22.     else exit mouseup
  23.   end if
  24.   if the optionKey is down then
  25.     locateme
  26.     readytoScript
  27.     exit mouseup
  28.   end if
  29.   if the commandKey is down then
  30.     newFile
  31.     exit mouseup
  32.   end if
  33.   if the shiftKey is down then
  34.     deleteLastColor
  35.     colorizeHC "Erase", rect of me
  36.     set the showName of me to true
  37.     go to this cd
  38.     exit mouseup
  39.   end if
  40.   togglePicture
  41. end mouseup
  42.  
  43. on newClipPict
  44.   global myPicture
  45.   get FullSFPack (P,,,"Name your new PICT file:", "Untitled")
  46.   if it is empty then exit newClipPict
  47.   put it into holdPictName
  48.   put holdPictName into myPicture
  49.   answer "Create thumbnail custom icon for your new PICT file?"¬¨
  50.   with "No" or "Yes"
  51.   if it is "Yes" then
  52.     ClipToPICT holdPictName
  53.     if the result ‚↠empty  then
  54.       answer the Result
  55.       exit newClipPict
  56.     end if
  57.     CreateCustomIcon holdPictName
  58.     if the result ‚↠empty
  59.     then answer the Result
  60.     dothePicture
  61.     exit newClipPict
  62.   end if
  63.   ClipToPICT holdPictName
  64.   if the result ‚↠empty  then
  65.     answer the Result
  66.     exit newClipPict
  67.   end if
  68.   dothePicture
  69. end newClipPict
  70.  
  71.  
  72. on togglePicture
  73.   locateme
  74.   if the showName of me is true then
  75.     put line 1 of the script of me into colorCommand
  76.     delete word 1 of colorCommand
  77.     do colorCommand
  78.     set the showName of me to false
  79.     go to this cd
  80.   else
  81.     set the lockscreen to true
  82.     colorizeHC "Erase", rect of me
  83.     set the showName of me to true
  84.     go to this cd
  85.   end if
  86. end togglePicture
  87.  
  88.  
  89.  
  90. on locateMe
  91.   put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  92.   item 2 of line 2 of the script of me & quote & ","   ¬¨
  93.   && quote & the rect of me & quote & "," &&  "," && quote & "transparent with dithering" & quote into line 1 of insertLine
  94.   put the script of me into holdScript
  95.   put line 1 of insertLine into line 1 of holdScript
  96.   set the script of me to holdScript
  97. end locateMe
  98.  
  99.  
  100. on newFile
  101.   global myPicture
  102.   answer file "Choose your picture:" of type PICT
  103.   if it is empty then exit newFile
  104.   put it into myPicture
  105.   dothePicture
  106. end newFile
  107.  
  108. on dothePicture
  109.   global myPicture
  110.   -- put "Look inside the button script for the path you just set" into message
  111.   colorizeHC "Erase", rect of me
  112.   go to this cd
  113.   colorizeHC "Add",  myPicture , TopLeft of me, rect of me
  114.   set the showName of me to false
  115.   go to this cd
  116.   put the script of me into holdScript
  117.   put "-- " && "colorizeHC" && quote & "Add" & quote & "," && quote & myPicture & quote & ¬¨
  118.   "," && quote & TopLeft of me & quote & "," && quote & rect of me & quote into holdLine
  119.   put holdLine into line 1 of holdScript
  120.   put "-- " && "," & myPicture & "," && " <-- This (item 2 of line 2) is the full path name of my current picture" into line 2 of holdScript
  121.   put myPicture into process
  122.   get the last char of process
  123.   if it is ":" then
  124.     exit dothePicture
  125.     answer "Try later with a better picture name." with "I know"
  126.   end if
  127.   if it is not ":" then
  128.     put it into holdPictName
  129.     delete last char of process
  130.     repeat until it is ":"
  131.       get the last char of process
  132.       if it is not ":" then  put it before char 1 of holdPictName
  133.       delete the last char of process
  134.     end repeat
  135.   end if
  136.   put "--  " && process & ":" && "<-- This is the path to pictures" into line 3 of holdScript
  137.   put "-- " && holdPictName && "<-- This (word 2 of line 4) is the name of the PICT file that I will open" into line 4 of holdScript
  138.   set the script of me to holdScript
  139.   put word 2 of line 4 of the script of me && the id of me into newName
  140.   set the name of me to newName
  141.   go to this cd
  142. end dothePicture
  143.  
  144.  
  145. on checkTools
  146.   global Tools
  147.   get the short name of this stack
  148.   if it is "ResGenie‚Ñ¢" then
  149.     put "Yep" into Tools
  150.     exit checkTools
  151.   end if
  152.   do get offset ("ResGenie‚Ñ¢", the stacksinuse)
  153.   if it is not "0" then
  154.     put "Yes" into tools
  155.     exit checktools
  156.   end if
  157.   if it is "0" then
  158.     answer "You need to use" && quote & "ResGenie‚Ñ¢" & quote &¬¨
  159.     "for this feature to work." with "Cancel" or "Use"
  160.     if it is "Use" then
  161.       start using stack "ResGenie‚Ñ¢"
  162.       put "Yes" into Tools
  163.     else
  164.       if it is "Cancel" then
  165.         put "Nope" into Tools
  166.       end if
  167.     end if
  168.   end if
  169. end checkTools
  170.  
  171.  
  172. on newbutton
  173.   put word 2 of line 4 of the script of me && the id of me into newName
  174.   set the name of me to newName
  175. end newbutton
  176.  
  177. on deletebutton
  178.   colorizeHC "erase", the rect of me
  179. end deletebutton
  180.  
  181. on readytoScript
  182.   set cursor to watch
  183.   put "Now checking all scripts..."
  184.   global holdScript
  185.   global colorauthoringpath
  186.   get offset ("makeitcolor", the script of this stack)
  187.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  188.   get offset ("on makeitcolor", the script of this bg)
  189.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  190.   get offset ("on makeitcolor", the script of this cd)
  191.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  192.   set the showname of me to true
  193.   togglepicture
  194.   put line 1 of the script of me into line 1 of insertLine
  195.   delete word 1 of insertLine
  196.   put the name of me into check
  197.   if word 1 of check is "bkgnd" then
  198.     put the script of this bg into holdScript
  199.     put "bg" into wheretoGo
  200.     put "send makeitcolor to this cd" into whattoSee
  201.     put the name of this bg into myName
  202.   end if
  203.   if word 1 of check is "card" then
  204.     put the script of this cd into holdScript
  205.     put "cd" into wheretoGo
  206.     put "end makeitcolor" into whattoSee
  207.     put the name of this cd into myName
  208.   end if
  209.   
  210.   get offset (insertLine, holdScript)
  211.   if it is not "0" then
  212.     answer "This picture has already been added here. Do you want to convert this to an ordinary button now?"¬¨
  213.     with "Yes" or "No"
  214.     if it is "Yes" then
  215.       do showdialog 3, "510",  , ,short name of me , "7",,
  216.       if the result is empty then exit readytoscript
  217.       put the result into hold
  218.       if line 1 of hold is "6" then set the style of me to "Transparent"
  219.       if line 1 of hold is "5" then
  220.         put word 1 to 2 of the name of me && "id" && the id of me into hold
  221.         select hold
  222.         domenu "Clear Button"
  223.         choose browse tool
  224.         set lockscreen to true
  225.         opencard
  226.         exit readytoscript
  227.       end if
  228.       set the name of me to line 2 of hold
  229.       put "on mouseup" into line 1 of temp
  230.       put "   " into line 2 of temp
  231.       put "end mouseup" into line 3 of temp
  232.       set the script of me to temp
  233.     end if
  234.     exit readytoscript
  235.     if it is "No" then exit readytoscript
  236.   end if
  237.   put quote & rect of me & quote into checkRegion
  238.   get offset (checkRegion, holdScript)
  239.   if it is  "0" then
  240.     do put offset (whattoSee, holdscript)  into whereGo
  241.     put insertLine & return before char  whereGo of holdScript -- this should add the new colors
  242.     do set the script of  myName to holdScript
  243.     do put "This picture has been added to" && the name of wheretoGo into message
  244.     answer "Do you want to convert this to an ordinary button now?"¬¨
  245.     with "Yes" or "No"
  246.     if it is "Yes" then
  247.       do showdialog 3, "510",  , ,short name of me , "7",,
  248.       if the result is empty then exit readytoscript
  249.       put the result into hold
  250.       if line 1 of hold is "6" then set the style of me to "Transparent"
  251.       if line 1 of hold is "5" then
  252.         put word 1 to 2 of the name of me && "id" && the id of me into hold
  253.         select hold
  254.         domenu "Clear Button"
  255.         choose browse tool
  256.         set lockscreen to true
  257.         opencard
  258.         exit readytoscript
  259.       end if
  260.       set the name of me to line 2 of hold
  261.       put "on mouseup" into line 1 of temp
  262.       put "   " into line 2 of temp
  263.       put "end mouseup" into line 3 of temp
  264.       set the script of me to temp
  265.     end if
  266.     exit readytoscript
  267.   end if
  268.   if it is not "0" then
  269.     answer "You are painting in an area already painted. This is not necessarily a problem, but painting the same region twice will take longer." ¬¨
  270.     with "Cancel" or "Continue"
  271.   end if
  272.   if it is "Cancel" then exit readytoScript
  273.   if it is "Continue" then
  274.     do put offset (whattoSee, holdscript)  into whereGo
  275.     put insertLine & return before char  whereGo of holdScript -- this should add the new colors
  276.     do set the script of  myName to holdScript
  277.     do put "This overlapping color has been added to" && the name of wheretoGo into message
  278.     answer "Do you want to convert this to an ordinary button now?"¬¨
  279.     with "Yes" or "No"
  280.     if it is "Yes" then
  281.      do showdialog 3, "510",  , ,short name of me , "7",,
  282.       if the result is empty then exit readytoscript
  283.       put the result into hold
  284.       if line 1 of hold is "6" then set the style of me to "Transparent"
  285.       if line 1 of hold is "5" then
  286.         put word 1 to 2 of the name of me && "id" && the id of me into hold
  287.         select hold
  288.         domenu "Clear Button"
  289.         choose browse tool
  290.         set lockscreen to true
  291.         opencard
  292.         exit readytoscript
  293.       end if
  294.       set the name of me to line 2 of hold
  295.       put "on mouseup" into line 1 of temp
  296.       put "   " into line 2 of temp
  297.       put "end mouseup" into line 3 of temp
  298.       set the script of me to temp
  299.     end if
  300.     exit readytoscript
  301.   end if
  302. end readytoScript
  303.  
  304. on deleteLastColor
  305.   put line 1 of the script of me into line 1 of insertLine
  306.   delete word 1 of insertLine
  307.   put the name of me into check
  308.   if word 1 of check is "bkgnd" then
  309.     put the script of this bg into holdscript
  310.     put "bg" into wheretoGo
  311.     put the name of this bg into myName
  312.   else
  313.     put the script of this cd into holdScript
  314.     put "cd" into wheretoGo
  315.     put the name of this cd into myName
  316.   end if
  317.   get offset (insertLine, holdScript)
  318.   if it is  0 then
  319.     answer "This picture has already been deleted" with "Okay"
  320.     exit deleteLastColor
  321.   end if
  322.   get offset ("add", holdScript)
  323.   if it  is 0 then
  324.     answer "You have already erased all the pictures here" with "I knew that"
  325.     exit deleteLastColor
  326.   end if
  327.   put the number of lines of char 1 to offset(insertLine, holdScript) ¬¨
  328.   of holdscript into KillLine
  329.   delete line KillLine of holdScript
  330.   colorizeHC "Erase", rect of me
  331.   go to this cd
  332.   do put "This picture has been removed from" && the name of wheretoGo into message
  333.   do set the script of myName to holdScript
  334. end deleteLastColor
  335.  
  336. on changeAttributes
  337.   put "--" into test --  because using "--" in a repeat structure causes format trouble
  338.   answer "Do you want this button to create a" && quote & "scaling" & quote && "picture?"¬¨
  339.   with "Cancel" or "Scaling" or "Normal"
  340.   if it is "Cancel" then exit changeAttributes -- 1 major end if
  341.   put the script of me into holdScript
  342.   put offset ("on locateMe", holdScript) into startPoint
  343.   put startPoint into oldStart
  344.   put offset ("end locateMe", holdScript) + 11 into endPoint
  345.   put char startpoint to endPoint of holdScript into newLocateMe
  346.   delete char startpoint to endPoint of holdScript
  347.   put offset ("put", newLocateMe) into startPoint
  348.   put offset ("insertline", newLocateMe) + 10 into endPoint
  349.   delete char startPoint to endPoint of newLocateMe
  350.   colorizeHC "erase", the rect of me
  351.   set the showName of me to false
  352.   if it is "Normal" then
  353.     --  foop put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  354.     --  item 2 of line 2 of the script of me & quote & ","   ¬¨
  355.     --  && quote & the topleft of me & quote & "," && quote & the rect of me & quote & "," && quote & "transparent" & quote into line 1 of insertLine -- endfoop
  356.     put offset ("foop", holdScript) + 4 into startpoint
  357.     put offset ("endfoop", holdScript) - 4 into stopPoint
  358.     put char startpoint to stoppoint of holdScript into holdCommand
  359.     answer "Do you want an opaque or transparent picture to be used?" with¬¨
  360.     "Transparent" or "Opaque"
  361.     if it is "Transparent" then
  362.       repeat with x = 1 to the number of lines of holdCommand
  363.         get word 1 of line x of holdCommand
  364.         if it is test then delete word 1 of line x of holdCommand
  365.       end repeat
  366.       put return & holdCommand  after line 1 of newLocateme
  367.       put newLocateme & return into char oldStart of holdScript
  368.       colorizeHC "Add", item 2 of line 2 of the script of me, the topleft of me , the rect of me, "transparent"
  369.     end if --  **
  370.     if it is "Opaque" then
  371.       put offset ("the rect of me", holdCommand) into startpoint
  372.       put the number of chars of holdCommand into endPoint
  373.       delete char startpoint to endPoint of holdCommand
  374.       put space & "rect of me & quote into line 1 of insertline" after last char of holdCommand
  375.       repeat with x = 1 to the number of lines of holdCommand
  376.         get word 1 of line x of holdCommand
  377.         if it is test then delete  word 1 of line x of holdCommand
  378.       end repeat
  379.       put return & holdCommand  after line 1 of newLocateme
  380.       put newLocateme & return into char oldStart of holdScript
  381.       colorizeHC "Add", item 2 of line 2 of the script of me, the topleft of me, the rect of me
  382.     end if -- **
  383.   end if -- **  end Normal branch
  384.   if it is "Scaling" then
  385.     --  boink put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  386.     --  item 2 of line 2 of the script of me & quote & ","   ¬¨
  387.     --  && quote & the rect of me & quote & "," &&  "," && quote & "copy with dithering" & quote into line 1 of insertLine -- endboink
  388.     put offset ("boink", holdScript) + 5 into startpoint
  389.     put offset ("endboink", holdScript) - 4 into stopPoint
  390.     put char startpoint to stoppoint of holdScript into holdCommand
  391.     answer "Do you want an opaque or transparent picture to be used?" with¬¨
  392.     "Transparent" or "Opaque"
  393.     if it is "Opaque" then
  394.       repeat with x = 1 to the number of lines of holdCommand
  395.         get word 1 of line x of holdCommand
  396.         if it is test then delete word 1 of line x of holdCommand
  397.       end repeat
  398.       put return & holdCommand  after line 1 of newLocateme
  399.       put newLocateme & return into char oldStart of holdScript
  400.       colorizeHC "Add", item 2 of line 2 of the script of me,  the rect of me ,, "copy with dithering"
  401.     end if -- **
  402.     if it is "Transparent" then
  403.       put offset ("copy", holdCommand) into startpoint -- because the default phrase was with "copy"
  404.       put startpoint + 4 into stoppoint
  405.       delete char startpoint to  stoppoint of holdCommand
  406.       put  "transparent" & space before char startpoint of holdCommand
  407.       repeat with x = 1 to the number of lines of holdCommand
  408.         get word 1 of line x of holdCommand
  409.         if it is test then delete word 1 of line x of holdCommand
  410.       end repeat
  411.       put return & holdCommand  after line 1 of newLocateme
  412.       put newLocateme & return into char oldStart of holdScript
  413.       colorizeHC "Add", item 2 of line 2 of the script of me,  the rect of me,, "transparent with dithering"
  414.     end if -- **
  415.   end if -- **  Should end Scaling branch
  416.   set the script of me to holdScript
  417.   go to this cd
  418. end changeAttributes